<?php

namespace Kunfeng\Dify\Model\Datasets;

/**
 * 知识库模型
 */
class Dataset
{
    private $id;
    private $name;
    private $description;
    private $indexingTechnique;
    private $permission;
    private $provider;
    private $createdAt;
    private $updatedAt;

    public function __construct(array $data)
    {
        $this->id = $data['id'] ?? '';
        $this->name = $data['name'] ?? '';
        $this->description = $data['description'] ?? null;
        $this->indexingTechnique = $data['indexing_technique'] ?? '';
        $this->permission = $data['permission'] ?? '';
        $this->provider = $data['provider'] ?? '';
        $this->createdAt = $data['created_at'] ?? null;
        $this->updatedAt = $data['updated_at'] ?? null;
    }

    /**
     * 从数组创建
     */
    public static function fromArray(array $data): self
    {
        return new self($data);
    }

    // Getters
    public function getId(): string
    {
        return $this->id;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getDescription(): ?string
    {
        return $this->description;
    }

    public function getIndexingTechnique(): string
    {
        return $this->indexingTechnique;
    }

    public function getPermission(): string
    {
        return $this->permission;
    }

    public function getProvider(): string
    {
        return $this->provider;
    }

    public function getCreatedAt(): ?string
    {
        return $this->createdAt;
    }

    public function getUpdatedAt(): ?string
    {
        return $this->updatedAt;
    }
}
